package com.wyp.design.pattern.creational.singleton.threadlocal;

/**
 * @author: yipeng.wang01@hand-china.com-25490
 * @TIME: 2020/2/15/23:18
 **/
public class ThreadLocalInstance {

    private static final ThreadLocal<ThreadLocalInstance> threadLocalInstance = new ThreadLocal() {
        @Override
        protected Object initialValue() {
            return new ThreadLocalInstance();
        }
    };

    private ThreadLocalInstance() {
    }

    public static ThreadLocalInstance getInstance() {
        return threadLocalInstance.get();
    }
}
